/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.casestudy1.bus;

import com.casestudy1.main.MainMidlet;
import com.casestudy1.view.LinearGradientPainter;
import com.sun.lwuit.Button;
import com.sun.lwuit.CheckBox;
import com.sun.lwuit.Dialog;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.TextField;
import com.sun.lwuit.animations.CommonTransitions;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.Style;

/**
 *
 * @author PC
 */
public class SearchStreet extends Form{
    private TextField txtStreet;
    private Label lbStreet;
    private Label lbResult;
    private CheckBox cbDetail;
    private Button btSearch;
    private Button btClear;
    private Button btBack;
    private TextArea taResult;
    
    public SearchStreet(final MainMidlet midlet){
        super("Tim kiem");
        Style titlestyle = new Style();
        titlestyle.setAlignment(CENTER);
        titlestyle.setBgPainter(new LinearGradientPainter(0, 0xffffff, false));
        setTitleStyle(titlestyle);
        getStyle().setBgPainter(new LinearGradientPainter( 0x330000, 0xFF0000, false));
        setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        setTransitionOutAnimator(CommonTransitions.createSlide(
                CommonTransitions.SLIDE_HORIZONTAL, true, 1000));
        
        txtStreet = new TextField();
        
        lbStreet = new Label("Ten Duong :");
        lbResult = new Label("Ket Qua :");
        
        cbDetail = new CheckBox("Chi tiet cac tuyen");
        cbDetail.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                Dialog.show("Chi tiet", "Chi tiet cac tuyen xe se duoc hien thi ngay sau day!", Dialog.TYPE_INFO, null,"OK",null);
            }
        });
        
        btSearch = new Button("Tim Kiem");
        btClear  = new Button("Xoa");
        btBack  = new Button("Back");
        btBack.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                midlet.showSearchBus();
            }
        });
        taResult = new TextArea(4, 10);
        
        addComponent(lbStreet);
        addComponent(txtStreet);
        addComponent(lbResult);
        addComponent(taResult);
        addComponent(cbDetail);
        addComponent(btSearch);
        addComponent(btClear);
        addComponent(btBack);
        
        
    }
}
